<template>
    <uni-popup ref="alertDialog" type="dialog">
      <uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="同意" title="通知" content="欢迎使用 uni-popup!" @confirm="dialogConfirm" @close="dialogClose">

      </uni-popup-dialog>
    </uni-popup>
</template>

<script setup>
import { ref,defineEmits, defineProps, watch, computed, reactive,onUnmounted } from 'vue';
const props = defineProps({
  dialog:{
    type:Boolean,
    default:false
  }
})
const alertDialog = ref(null)
watch(() => props.dialog, (newVal,oldValue) => {
  if (newVal == true) {
    alertDialog.value.open()
  }
},
    {
      immediate: true,
      deep: true
    }
)
const emit = defineEmits(['close'])
const msgType = ref('success')
const dialogConfirm = () => {
  alertDialog.value.close()
}

const dialogClose = () => {
  alertDialog.value.close()
  console.log(alertDialog.value);
}

</script>

<style scoped>

</style>